using NL.UI;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

namespace XGame.UI
{
    public interface IPropertySetting
    {
        string _RequestPropertyName(int _type);
    }
    public class UIPropertyAnnex : UIBase
    {
        public Image uiIcon;
        public Text uiName, uiValue;
        public int Type;
        public string Name;
        public float Point,Factor;
        IPropertySetting _SettingOwner;
        // Start is called before the first frame update
        protected override void OnShow()
        {
            base.OnShow();
            if(_SettingOwner==null) _SettingOwner =  GetComponentInParent<IPropertySetting>();


            XGameUISetting _Setting = GetComponentInParent<XGameUISetting>();
            if (Type >= 0 && _Setting!=null && uiIcon!=null)
            {
              //  uiIcon.sprite = _Setting.GetPropertyICON(Type);
            }

            if (uiValue != null)  uiValue.text =Factor>0? $"{(Factor*100)}%"  : Point.ToString();

            if (Type >= 0 && _Setting != null && uiName != null)
            {
               // uiName.text = _Setting.GetPropertyName(Type);
            }
           // if (uiName != null) uiName.text = Name;
        }

        public UIPropertyAnnex Set(int _type, float _point,float _factor)
        {
            Type = _type; Point = _point; Factor = _factor; return this;
        }

        // Update is called once per frame
        void Update()
        {

        }

    }

}
